package com.igeek.oa.service.impl;

import com.igeek.oa.entity.OfficesuppliesApply;
import com.igeek.oa.mapper.OfficesuppliesApplyMapper;
import com.igeek.oa.service.IOfficesuppliesApplyService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 * 办公用品和办公用品申请表的中间表 服务实现类
 * </p>
 *
 * @author author
 * @since 2024-08-30
 */
@Service
public class OfficesuppliesApplyServiceImpl extends ServiceImpl<OfficesuppliesApplyMapper, OfficesuppliesApply> implements IOfficesuppliesApplyService {
    @Autowired
    private OfficesuppliesApplyMapper officesuppliesApplyMapper;
    @Override
    public void addOfficesuppliesApply(List<OfficesuppliesApply> officesuppliesApplyList,String aId) {
        System.out.println("前端集合数据"+officesuppliesApplyList);
        for (int i = 0; i < officesuppliesApplyList.size(); i++) {
            OfficesuppliesApply officesuppliesApply = new OfficesuppliesApply();
            officesuppliesApply.setOffsupappId(aId);
            officesuppliesApply.setOffsupId(officesuppliesApplyList.get(i).getOffsupId());
            officesuppliesApply.setCount(officesuppliesApplyList.get(i).getCount());
            officesuppliesApplyMapper.insert(officesuppliesApply);
        }
    }
}
